import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;


//读数据转为字符流
public class Demo11 {
    public static void main(String[] args) {
        try(InputStream inputStream = new FileInputStream("C:/测开/test.txt")) {
            //此时Scanner 就是从文件读取
            Scanner scanner = new Scanner(inputStream);
            //就可以使用scanner读取后续的数据
            String s = scanner.next();
            System.out.println(s);
        }  catch (IOException e) {
            e.printStackTrace();
        }
    }
}
